package com.object.module.cbb.controller;

import com.object.configuration.utils.PageUtils;
import com.object.configuration.utils.Q;
import com.object.module.cbb.entity.CbbSortEntity;
import com.object.module.cbb.service.CbbSortService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;


/**
 * 
 *
 * @author 小🌤
 * @email 1578442339@qq.com
 * @date 2022-03-28 11:17:49
 */
@RestController
@RequestMapping("/cbb/cbbsort")
public class CbbSortController {
    @Autowired
    private CbbSortService cbbSortService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public Q list(@RequestParam Map<String, Object> params) {
        PageUtils page = cbbSortService.queryPage(params);
        return Q.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{stId}")
    public Q info(@PathVariable("stId") Integer stId) {
            CbbSortEntity cbbSort = cbbSortService.getById(stId);
            return Q.ok().put("cbbSort", cbbSort);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public Q save(@RequestBody CbbSortEntity cbbSort) {
            cbbSortService.save(cbbSort);
            return Q.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public Q update(@RequestBody CbbSortEntity cbbSort) {
            cbbSortService.updateById(cbbSort);
            return Q.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public Q delete(@RequestBody Integer[] stIds) {
            cbbSortService.removeByIds(Arrays.asList(stIds));
            return Q.ok();
    }

}
